import { createApp } from 'vue'
import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import App from '../App'

let ms = require.context('./modules', false, /\.js$/);
let modules = {};
ms.keys().forEach(item => {
    let name = item.substring(2, item.length - 3);
    modules[name] = ms(item).default
})
const store = createStore({
    modules
})

const app = createApp({ App })

// 将 store 实例作为插件安装
app.use(store)
export default store